UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F9xryQiSA/gXuJ9iYfqSMTx6WZWgwUnorWE9HfTWigg='
WHERE
key_id = 'a2cefe31eb998b403689cea58112e3dbd3411a454c9e4d3fbe1e157a71df3be6'
AND (
token = 'F9xryQiSA/gXuJ9iYfqSMTx6WZWgwUnorWE9HfTWigg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)