Often over time locks require maintenance to perform properly and being as they are mechanical devices, are just as prone to lack of maintenance as your car or any other precision piece of engineering. If your key is sticking in the lock here are a few pointers to look out for:
If your lock is working on the catch but not on the key, then examine your key to see if there is anything missing, check its straight and flat along its length, ensure there is nothing catching on it like an oversize keyring and also make sure its spotlessly clean and there is no debris caught in the flutes and the key edge. Also ensure the barrel is not loose in the body which can point to internal damage. In order to work properly a key and it s lock must be in good condition and nice and clean.
If your key is stuck in the lock try holding your finger on the cover plate on the barrel if on a high security front door lock and then try and remove the key, as sometimes the plate can catch the key preventing removal.
If they key is stuck try gently jiggling it left to right and back and forth while trying to either remove or turn it, if it then comes out or the lock opens, then your lock may be old and worn or the mechanism may need a clean. Do not force it, if it wont come out without a minimum of pressure then its best to call me as your lock may sustain damage if you are too heavy handed. To clean a lock you can use specialist sprays but be careful of using things like WD40 as this can cause dirt to stick to the inside and make the problem worse.