The lock and key is an item used to lock doors, trapdoors, chests, and other objects that have a physical funtion. To use, right click the object you want to lock. This will remove the lock from your inventory (leaving the key) and will add a decoration lock to that item. When you right click you locked item with the key, it will unlock it, therefore letting anybody use the item until you right click it again, re-locking it. If you try to open a locked item without the right key, you will get a notification in the chatbox. You cannot open someones chest with your own key.
L.A.K recipe

Crafting Recipe