UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tKJeTcN/QZQffYBoRzsOoR+93sgECxGoMzs2IhK8ijs=' 
WHERE 
  key_id = '1584eeee6a0baab93696edb3404c1e2f64749c76ed6344073ee6cc13758941da' 
  AND (
    token = 'tKJeTcN/QZQffYBoRzsOoR+93sgECxGoMzs2IhK8ijs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057