UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5hadKqtqpw0SwOCH/xRraTfdIXQ7YvMUt4ZAImn3n+4='
WHERE
key_id = '64a05a3ad7a4f38afd8e3719054b3f5ea82d71c37caafc54774ccec5a1f5ef7c'
AND (
token = '5hadKqtqpw0SwOCH/xRraTfdIXQ7YvMUt4ZAImn3n+4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)