UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wSnOD6HIRv9WFAQ7ZZZwbcAlX0D2R4RZG7HEm7+x/04='
WHERE
key_id = 'f8c3739de8ffee45f854c510d61599224190174a3070cb409324fa5889352598'
AND (
token = 'wSnOD6HIRv9WFAQ7ZZZwbcAlX0D2R4RZG7HEm7+x/04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)