GET_LOCK('lock_name', timeout) is used to lock something by name, so that only one user or program can do a certain task at a time.
RELEASE_LOCK('lock1') removes the lock, so someone else can use it.
SELECT GET_LOCK('lock1', 10);
It tries to get a lock called 'lock1'.
If someone else has it, MySQL waits up to 10 seconds.
if locked return 1 else 0
Imagine a shop where only one cashier can use the register at a time:
One cashier runs GET_LOCK('register', 10) → gets access.
They finish work and run RELEASE_LOCK('register').
Now another cashier can get the lock.