Ok I have been testing a few things.
I have a dash cam that's plugged into the 12v socket under the lid in the centre console. When the car turns on the dash cam automatically turns on and turns off automatically after about 13sec when the car is turned off. Same time it takes for me to be able to lock the car. If the the dash camera is off I can lock my car. The camera has lots of sensors, GPS, night vision, accelerometer and motion detection. I think one of these is interfering with the cars ability to detect and sensor the key.
I've tried unplugging from the 12v socket before getting out and locking but I still have to wait for the dash cam to power down.
......Wonder if I should try shielding the camera with something.