When the vigilantes come to the sheriff's office to try to take the prisoner and hang him, it is supposed to be night, and it is dark on the porch in front of the door, when looked at from the street. But when the camera changes to show the street scene and the crowd, there is full sunshine.
When the sheriff, then Earp, unlock and lock the sheriff's office door, they just jiggle the keys. Perhaps they were just for effect, and the lock was not real.