Add spec to Registry.lock/3 (#15575)