Classic problem. The locking system works by compressed air and the problem is most likely caused by leaks in the tubing or seals in the doors. A common result is that the pump at the rear continues pumping for an extended period of time, whilst the air escapes through the leaks rather than to change the pressure to lock the doors.
The first place to start is to identify where the leak is (obviously). Leaks often first occur at the fuel cap. Secondly, usually leaks will be found in the door locks, within the seals. If you can hear a faint hissing sound in at least one of the doors whilst the system is unlocking, then you have most probably found your problem.
Chances are that the seal (a seal in the door lock is my best guess) is not quite bad enough that the system can't unlock, but insufficient to take the pressure of locking. I expect that the part will need replacing.