The work "lock" usually refers to a mechanical device that secures a door.  An object called a "key" is used to control a lock's function.  When the lock is active, the door cannot be opened.  When the key is inserted and turned, the lock is inactivated and the door can be opened.