UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SLn/NY31XehSQf2K4jGYJC6HMqSRmTma1qJ8Y1bT4S8='
WHERE
key_id = '565df4c4e25dec2660c51d81c664e28c908b4167e05e0092e7b9c1393d235881'
AND (
token = 'SLn/NY31XehSQf2K4jGYJC6HMqSRmTma1qJ8Y1bT4S8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)