UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cOJudW8qi0cb6HfGcml4pfCtSAzsV387N2q89WItsys='
WHERE
key_id = 'af8a791ebd5df1e01c7c946631107bdd2f027a0564b440732e3f42a9bfa9cb37'
AND (
token = 'cOJudW8qi0cb6HfGcml4pfCtSAzsV387N2q89WItsys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)