UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hHvN3gyX7jAS7c/iUdNZZv8kxXjJlpM7r68knRV8RMI='
WHERE
key_id = 'fff4a2d430c537ae6a2d6938cf41a668f198753095300ef3c33090af2d4ef3dd'
AND (
token = 'hHvN3gyX7jAS7c/iUdNZZv8kxXjJlpM7r68knRV8RMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)