I just had exactly this problem and the following worked a treat (you have to be able to see the side of the bolt) : Insert the correct key and turn it gently in the direction that locks the door. You feel slight resistance as it lifts the levers to free the bolt, then it contacts the bolt and won't turn any further. Now gently hold the key in that position. Press the end of a flat screwdriver or similar implement against the side of the bolt and edge it back to the unlocked position. Prevention: I had the problem after heavy rain and suspect that the wood swelled and pushed the bolt a millimetre or two back into the lock so the key couldn't engage. Chisel out a bit more wood so this doesn't happen again.
This was very helpful advice. I had a lock that was stuck locked and the key would not unlock at all, even after WD40. So I turned the key in the lock direction as suggested and in fact simply needed to press the bolt with the screwdriver and it immediately released and would unlock. Many thanks Steve!