UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g9SDbp2AXwEVcYKs/7cNgxRFSo53VaR0ZNwharSgxG4='
WHERE
key_id = '9a648b7a2a027fbc76bd88c3e9e3e535d604a6d95b6058504a830fecc5d229d7'
AND (
token = 'g9SDbp2AXwEVcYKs/7cNgxRFSo53VaR0ZNwharSgxG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)