UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q7KuoONlvnYRSOIbQudIlQp1VpoFVcc2qWucLJXQvZs=' 
WHERE 
  key_id = '66482d9cbb1cc4de5f4bd1618ec4f10434cd6714c7449971f7c3d43ea53210a7' 
  AND (
    token = 'Q7KuoONlvnYRSOIbQudIlQp1VpoFVcc2qWucLJXQvZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032