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