MYSQL Update by condition in Code Igniter

This is the MySQL version Syntax:

UPDATE table1 
    JOIN (
            SELECT mId, COUNT(*) c 
            FROM table1 
            GROUP BY mId 
            HAVING c < 2
        ) t1 
USING (mId)
    SET shared=0 ;

This means that if a value of mId only appears once in the mId column, then set shared = 0.

How to rewrite it in PHP code igniter?