title: Check if record exists, if yes "update" if not "insert"
body: <p>I want to check table <code>PREMIUM_SERVICE_USER</code> if any records exists for 
  <code>strClientID</code> update <code>timeValid</code> for +30 if no records for <code>strClientID</code> insert to <code>premium_service_user</code> table. </p>
  
  <p>What am I doing wrong? </p>
  
  <p>It increases <code>timeValid</code> for +30 days but inserts another row too.</p>
  
  <pre><code>SELECT @pre_var = count(*) 
  FROM PREMIUM_SERVICE_USER 
  WHERE strClientID = @strClientID
  
  /* bronze premium - 200 cash */
  IF @Premium = 1
  BEGIN
      INSERT INTO PREMIUM_SERVICE_USER 
          (strClientID, timeReg, timeValid, bCurrent, durum) 
      VALUES 
          (@strClientID,getdate(),getdate() + 30,'1','1')
  
      UPDATE TB_USER 
      SET cash = cash+200 
      WHERE strAccountID = @strClientID
  END
  
  IF @Premium = 1 AND @pre_var = 1
  BEGIN
      UPDATE PREMIUM_SERVICE_USER 
          SET timevalid = timevalid+30 where strClientID = @strClientID
      UPDATE PREMIUM_SERVICE_USER 
          SET bCurrent = 1 where strClientID = @strClientID
      UPDATE TB_USER 
          SET cash = cash+200 WHERE strAccountID = @strClientID
  END
  </code></pre>