TheoreticallyA built-in lock can be defrosted by pouring heated non-freezing liquid into the keyhole, such as the car antifreeze or windshield cleaning liquid. Then when the door is open, you can think of changing the lock to an external type.
For an external or handheld type of lock (the one that is not inside a door, but outside of it), theoretically, you could submerge the whole lock into a liquid that has a very low freezing temperature, so low that it actually won't freeze at all during the winter. But be careful with the chemical composition that may damage your lock.
Normally, you could just heat the lock up by burning pieces of paper under it for some time.