Take the switch out of the door. First remove the 2 screws that hold the switch panel in. Next, pull the switch panel out of the door armrest, and on the back of the switch panel, there are a couple more screws that secure the wiring. Remove those, then carefully unplug the back half of the switch panel so the pins slide out. Now that you got it out, spray something like QD electronic parts cleaner all over the terminals. Plug it back in, but dont attach the screws yet. Test the lock function now. If it still don't work, unplug again and spray cleaner underneath the switch rockers themselves. You want to get cleaner into the "clicking" switch contacts inside. Spray and push switch multiple times back and forth, spray again then repeat. Shake of excess cleaner and let sit a minute to dry. Plug back in and test.
If that still don't fix it, then either the switch went bad or there is a wiring problem. Do the power window switches work?