Many of the homes have locks and hinges that have not been lubricated in a long time. Sometimes my handyman customers call me to repair or replace locks that could have continued to work properly, if they just would have received regular lubrication. Doors will also function better, if the hinges have periodic lubrication.
The changes in temperature and humidity that occur in have an effect on the mechanism of locks and hinges. When the locks and hinges dry out too much, friction is created between the moving parts, causing wear.
In the past, graphite was recommended as a lubricant. We don't use graphite anymore, nor do we use oil. Too much graphite and even a little amount of oil can clog the lock with enough debris to cause more harm than good. I always use WD -40 because it cleans as it lubricates, it does a great job and it is easily available. I have seen WD-40 work wonders on some locks that weren't operating properly. Of course, lubrication must be used on a regular basis and for some neglected locks, there is no alternative except replacement.
When lubricating a lock, I squirt WD-40 into the keyway and also onto the latch. Then I work the key in and out and clockwise and counterclockwise a few times to reach the pins and springs inside the lock. I also work the latch back and forth a few times with the door open, so that I can observe the movement of the latch.
The hinge is lubricated along the barrel and then the door is partially opened and closed several times as the swinging back and forth helps to spread the lubricant.
The three photos below, I show the correct points for the lubricant to be sprayed for the lock keyway and latch and the hinge barrel.