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