I am surprised. We don't actively try to lock the key in the car, but when Mrs S leaves it in the centre console and I try and lock it, it doesn't.
There is one way to try and stop this happening again. Get the app set up on your phone, then you should be able to unlock the car with your phone...