MySQL stored procedure updates twice I have this stored procedure:

DELIMITER $$
CREATE PROCEDURE updateTrendContentStats(IN mongoid VARCHAR(255),IN numericid INT,IN points INT,IN ctype INT,IN activity INT,IN created INT)
 BEGIN
   DECLARE row_count INT(1) default 0;
   SELECT count(id) into row_count FROM trendContentMaster WHERE pid=numericid;
   IF row_count = 0 THEN
     INSERT INTO tMaster(tci,pid,tct,tcd,tcf,tcm,tcf,s)
       VALUES(mongoid,numericid,ctype,points,points,points,points,1);
   ELSE
     UPDATE tMaster 
       SET tcd = tcd + points,tcw = tcw + points,tcm = tcm + points,tcf = tcf + points 
       WHERE pid=numericid;
   END IF;
   INSERT INTO tTransaction(tci,pid,tct,act,acp,cd)
     VALUES(mongoid,numericid,ctype,activity,points,created);
 END $$
DELIMITER


Which works fine, except it updates tMaster field twice. For example existing value of tcd, tcw, tcm, tcf is 30 and points value is 20 rather than 50 it updates value to 70. 

What am I doing wrong in the increment operation?
If the table tMaster have the same pid inserted but is not in the table trendContentMaster it will update 20*(rows) depending how many times pid is inserted in tMaster table. This should work for you:

    DELIMITER $$
    CREATE PROCEDURE updateTrendContentStats(
    IN mongoid VARCHAR(255),
    IN numericid INT,
    IN points INT,
    IN ctype INT,
    IN activity INT,
    IN created INT)
     BEGIN
     DECLARE vCount INT(1) default 0;
     DECLARE vCount02 INT(1) default 0;

     SET vCount=(SELECT count(*) FROM trendContentMaster WHERE pid=numericid);
     SET vCount02=(SELECT count(*) FROM tMaster WHERE pid=numericid);

     IF (vCount = 0 &amp;&amp; vCount02 = 0) THEN
        INSERT INTO tMaster(tci,pid,tct,tcd,tcf,tcm,tcf,s) VALUES(mongoid,numericid,ctype,points,points,points,points,1);
     ELSE
        UPDATE tMaster 
        SET tcd = tcd + points,
            tcw = tcw + points,
            tcm = tcm + points,
            tcf = tcf + points WHERE pid=numericid;
     END IF;
     INSERT INTO tTransaction(tci,pid,tct,act,acp,cd) VALUES(mongoid,numericid,ctype,activity,points,created);
     END $$
    DELIMITER


PD: You should make a Foreing key in tMaster.pid.