With some cars not locking the car keeps the car's electrical system "alive" far longer and at a higher draw than locking the car. Locking the car "signals" to the car's electronics the car is not going to be used again for a while so the electronic/electrical systems power down promptly.If you lock the car, it activates the security system on the car, increases electrical load on battery. Its small but over time it will drag a battery down, every time. If you have the car in a locked garage, don't lock it. That will reduce parasitic amperage draw. If you lock it, put a trickle charger on it.( if you store it for weeks at a time, I'd put a trickle charger on it.)
They do help extend battery life.