UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4D+eqsjJskqmCTyDWIzQpkPPO1vEXJ4oXx3kJQTUo8w='
WHERE
key_id = 'a538559e22af410cccd6b56aa6582397d91f992a556087ab1f575539cd9b308b'
AND (
token = '4D+eqsjJskqmCTyDWIzQpkPPO1vEXJ4oXx3kJQTUo8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)