Spray the lock with light penetrating oil (Tri-Flow General Purpose Lubricant Spray) into the keyhole and onto the bolt mechanism. Move the bolt in and out to allow the oil to penetrate into the lock. Do not take the lock apart if you are not confident you can put it back together.
After you have tried the above solution, check to see it the lock operates smoothly with the door open. If it does, your lock problem is not in the lock, but rather in the alignment of the door and frame. Look for obstructions at the threshold and in the door jamb. Also check the door and frame for twists and warps. The door should completely rest against the door stop and stay there. If the door rests at the stop at the top or bottom only then the door or frame is twisted. If the door springs open then the hinges are probably binding. If you have weatherstrip on the door, it could be obstructing the path of the door. Keep in mind, wooden doors and frames will warp and swell with temperature and humidity, and metal doors and frames will twist and rust with age.