Lock and keys were well known in Roman times. The keys even have a serious advantage over modern keys, they also act as a hack :)
Copyright to these pictures: Menno Holscher and Betty Steevens