title: Execute update if row exists else do insert
body: <p>I have to update a number of rows to a table, if the updating row is not existing in the table I need to insert that row. I cannot use unique key, so no use with <strong>ON duplicate KEY UPDATE</strong></p>
  
  <p>I have to achieve something like this</p>
  
  <pre><code>DECLARE count DOUBLE;
  SELECT count(uid) 
  INTO   count 
  FROM   Table 
  WHERE  column1  ='xxxxx'
   AND   column2='xxxxx';
  
  IF (count=0)
  THEN
      --peform insert
  ELSE
      --perform update
  END IF
  </code></pre>
  
  <p>This is for a high performance application.Any ideas? Code level or Query level</p>
  
  <p>FYI : Database is Mysql</p>