UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TssxxqhFRPxq/BRs2isJAg9AOgxdPr8+F2Eun2wpMwc='
WHERE
key_id = 'afe4b2c80cd5b2180fcc5188450154725968056e9a0051df73165905cbdf233a'
AND (
token = 'TssxxqhFRPxq/BRs2isJAg9AOgxdPr8+F2Eun2wpMwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)