UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fqt+aGaegP3Lw52ItaJ4sqPVHWgJVk2zHXSt4WDcOBQ='
WHERE
key_id = '0664a9f02fb3609cb6a9efb9277f4661b7c7053bd300ba42c858096f81fe62ae'
AND (
token = 'fqt+aGaegP3Lw52ItaJ4sqPVHWgJVk2zHXSt4WDcOBQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)