I had a similar problem with my previous car (Toyota Avensis).
Mine wasn't locking it self, it was UNLOCKING it self! Sometimes right after i had it locked, sometimes after an hour or so!...
I think that's worse... :D
I could hear it, while driving, trying to unlock the already unlocked doors.
I went to a Toyota dealer and they changed the whole electrical part of the locking device in the drivers door. That fixed the problem.
Somekind of undetectable electrical leak they said. The car was 3-4 months old.