Achieving this is going to be vehicle dependent. You will need information from the BCM, or you could tap into the door "lock" actuator circuit to verify when the vehicle has been locked. Also, depended on the vehicle, most have a switch in the ignition lock cylinder that senses when the key is inserted, you would need to tap into that circuit. Good luck.
Ed