UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nJh9WTMmNZ1VqpM+9T+HURArzkks3eZXg8wNuggQ3wk='
WHERE
key_id = '1bc7409d7a3032b783245d026e90a4c27f2a85e5ac22d5d8f2d58694072b779f'
AND (
token = 'nJh9WTMmNZ1VqpM+9T+HURArzkks3eZXg8wNuggQ3wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)