UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c/wGyuabbH03n3gPG2mPMsEtDrM3Ls0ovz1TYl6zI2A=' 
WHERE 
  key_id = 'd96c36ac720a3d758aaa131d8abcc00a7c462cab81e2658b6391cfcc11f605d1' 
  AND (
    token = 'c/wGyuabbH03n3gPG2mPMsEtDrM3Ls0ovz1TYl6zI2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032