UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'id7FoX4JcFk9csO5MsFbqislDO3wvyaidrdWhDZlgbI='
WHERE
key_id = '9c6d5f758f9e103d6a63faa1f632181c5e4fb3fc69446a34d985d810e19a208d'
AND (
token = 'id7FoX4JcFk9csO5MsFbqislDO3wvyaidrdWhDZlgbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)