UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TBaOGs1ZLEMtOJ0nqBTpQdR3KxDZ5Ydu6wLY7paJM0g='
WHERE
key_id = '8341a284b62f6e9c256c266bdda9a0602fc5bec11cb607cc1ee040a917a88bf4'
AND (
token = 'TBaOGs1ZLEMtOJ0nqBTpQdR3KxDZ5Ydu6wLY7paJM0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)