UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uN7pBYAMreopTR+QR1AgDhRTTjhZkPV2HwlJSxju0cw='
WHERE
key_id = '663b15c520186107f88990c216b233e37200daf42bad962ca26e3958ba033b30'
AND (
token = 'uN7pBYAMreopTR+QR1AgDhRTTjhZkPV2HwlJSxju0cw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)