UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hql1BSPpFjHc1vGavtCTbT97TKPuy7qvXOzAMWd6mGI='
WHERE
key_id = 'ed817352646c39ba9308e34504938f95f97b65d6484bcfd177841e97f3c5d67d'
AND (
token = 'Hql1BSPpFjHc1vGavtCTbT97TKPuy7qvXOzAMWd6mGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)