UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ScA5rjnFlkZr88kwdTRF75EZ+9aCz0HBWFO4tuZVbU4='
WHERE
key_id = 'f2f89da77d45be01ccd8a5aac43e9439a8dac4a7ea83ae97e14e7a2e5ebd7a8c'
AND (
token = 'ScA5rjnFlkZr88kwdTRF75EZ+9aCz0HBWFO4tuZVbU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)