UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eRH9kbcGNr0y0asa0ZbSBAC2YfLQSx97FVmDkKZ+lu4='
WHERE
key_id = 'd3863106ecb8db51e39570ce11fd6e13d5258eb01673beeb652a269f3c074cbc'
AND (
token = 'eRH9kbcGNr0y0asa0ZbSBAC2YfLQSx97FVmDkKZ+lu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)