UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5IO32d55Qsg25FFcOpeN7bF364l9CiQHiRGaVkvzess=' 
WHERE 
  key_id = 'c13fce817e438367a21dac79b898b888997cad815b449dd0bb8ff1395dc7729d' 
  AND (
    token = '5IO32d55Qsg25FFcOpeN7bF364l9CiQHiRGaVkvzess=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042