UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'swRnw9yPmt+0PRGMAHKl4N1b+iWJL2eWbJ5QONM2odY='
WHERE
key_id = 'ac9fb9894c0578bc29a71f1573a975339102c1ab88e2c10552c379d716e27282'
AND (
token = 'swRnw9yPmt+0PRGMAHKl4N1b+iWJL2eWbJ5QONM2odY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)