UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o0VuH0r1HpbJKlcaXDVTRKkAYjEFJbsb4DnCc9jC9UI='
WHERE
key_id = 'b4ce7a08d6341e6b6c4c48665515dc5011e36e0d2256654072a7646b0ef3d762'
AND (
token = 'o0VuH0r1HpbJKlcaXDVTRKkAYjEFJbsb4DnCc9jC9UI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)