UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BMS77R7gBa5ls1RwfGoQo3k9swGWv+5HFQGkoKksGSc='
WHERE
key_id = '9931768bc0bb527d52e4cd33f50f9bc1639830ef12f2f517c59a73698195c881'
AND (
token = 'BMS77R7gBa5ls1RwfGoQo3k9swGWv+5HFQGkoKksGSc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)