The invention relates to a lock (20, 120, 220, 320, 420), in particular a
cam lock, having a lock housing (22, 122, 222, 422) and a lock cylinder (26, 126, 226, 326, 426) rotatably supported in the lock housing (22, 122, 222, 422), wherein the lock cylinder (26, 126, 226, 326, 426) is configured on a first end (38, 138, 238) accessible from a front side (28, 128, 228) of the lock (20, 120, 220, 320, 420) for
torque transmission of a key (2, 102, 202, 302, 402), in particular a plug-in key, wherein the lock (20, 120, 220, 320, 420) has a blocking element (52, 152, 252, 352, 452) which, in the event of extraction of the key (2, 102, 202, 302, 402), prevents a rotation of the lock cylinder (26, 126, 226, 326, 426) in the lock housing (22, 122, 222, 422) between an open position and a latching position, and wherein the blocking element (52, 152, 252, 352, 452) is configured for releasing a rotation of the lock cylinder (26, 126, 226, 326, 426) in the lock housing (22, 122, 222, 422) between the open position and the latching position when a key (2, 102, 202, 302, 402), in particular a plug-in key, having a given
magnet structure (12, 112, 212, 312, 412) is inserted into the first end (38, 138, 238) of the lock cylinder (26, 126, 226, 326, 426). The invention also relates to a key (2, 102, 202, 302, 402) and a lock
system (80, 180, 280, 380, 480).