UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qC29XX8ARKF5r9nJxVcmWQX9Y6kIJVYnolbdGvgYnto='
WHERE
key_id = '2831e6ce74f70afc774aa991dd484eb7647ad378c9cdb78aff27073417b86ab1'
AND (
token = 'qC29XX8ARKF5r9nJxVcmWQX9Y6kIJVYnolbdGvgYnto='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)