Here is an infographic from Half Price that looks at the evolution of keys and locks. The first lock of note was the Assyrian lock in 600 BC and it actually used the still very common technique of sliding tumblers into place. From there, we had the revolutionary Bramah Lock which was considered the first commercially produced product to provide good security from manipulation. In more modern times, the technology has improved further with keycards and keypads becoming more popular.
[Click image for full size version]