All locks can be working of the same key. Just make your master key, and "attach" it to the lock, then "attach" the lock to gate or chest or whatever, and congratulations

.
** To "attach" a key to a lock, right click the lock with the key, and then, to attach the lock to a gate right click the gate. Also, to attach a slave key to a mate, first make the slave key, then take the key and right click it on your mate, in order to make him use it.