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