UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tOip8ov5gMBkpSMf1WHa8QSMRiD++4+IdSIFe2EEFeQ='
WHERE
key_id = 'cc79aa829eda9642db42a7f1b0a1d1767321cb41c798a80437db92e0818925e9'
AND (
token = 'tOip8ov5gMBkpSMf1WHa8QSMRiD++4+IdSIFe2EEFeQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)