I had the same problem. It was the trunk lock causing it.
When you unlock the car the the rubber part of the trunk lock vacuume activator keeps the trunk lock open. In my car that part had cracked and it was letting the locking mechanism of the trunk to go back to locked position. There is the sensor at the trunk lock that tells the central locking system that the vacuume locking mechanism of the trunk is going back to locked position. The central locking system thinks you put a key into the trunk and locked the car from the trunk lock. This was causing auto locking in about 1-5 minutes. I really don't know the exact name of the rubber part. That part is located on top end of the vacuume activator.
You should open the trunk and open one of two plastic covers at the back of the trunk lock. You should pull the cover at the right side and see if the rubber of the vacuume activator is cracked and watch if activator is going back to locked position after you unlock the car. I need that rubber part too. If you find it cheap let me know where you found it.
1989 230E, 8v, 166.000 km, updated to 94/95 trunk & hood
2002 Daewoo Nexia 50.000 km
1987 VW Jetta GLE 16V, Recaro seats
1982 Volvo 240 DL (lovely car!)
and few more american cars.