Do not spray WD40 into your door locks or latches, it will leave an oil film which will attract dust, this causes a rough paste to form and wear out your locks.
graphite powder is nice but can stain your clothes, you can use beeswax but will take some finagling to work (wax heater or candle pot)
also if your car does not have keyless entry then make it a habit to lock the doors with the key from the outside, this way you will never lock the key inside.