UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bOMFqjErAWvY9bvyVeSwdAwiQmryRBWtwfkLx+JMCSM='
WHERE
key_id = 'c3349160d0dd11b60d7e4b9a1e6f52e7e407da294f99a899b78587dede47b59c'
AND (
token = 'bOMFqjErAWvY9bvyVeSwdAwiQmryRBWtwfkLx+JMCSM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)