The oldest known lock (estimated at 4000 years old) was found in the Khorsabad palace ruins near Nineveh. It works much like a modern pin tumbler lock, but made of wood. There were several wooden pegs that operated like the modern metal pins. They were held in place with a large wooden bolt. The key to this huge lock would have been huge itself.
Locks and keys are mentioned in the Old Testament. Keys represented authority, security, and power. The delivery of keys to King in a castle after it was defeated was a ritualized ceremony and is probably the fore-runner to the modern Key to the City ceremony that we practice now. Keys were a status symbol; a sign of authority. In ancient Egypt, the heads of household owned slaves whose purpose was to carry a man's keys. If he has several of these slaves, he was considered to be a man of great power and wealth. So the lock and key are seen as very prestigious -- a representation of power and authority. Keys imply that you possess something of great value -- something that others might want or covet.
Keys can represent all forces that open and close, bind and release, liberate or incarcerate.
Interesting website here on the history of keys.