UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USjwPf5lDDRDcAwqS/IhhoxJXtGhww37dDrMC4a10o4='
WHERE
key_id = '40090e307ef29718b96e0dc3750a4c91311547a96b7b5b2c158ca602601b7c60'
AND (
token = 'USjwPf5lDDRDcAwqS/IhhoxJXtGhww37dDrMC4a10o4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)