Update column based on sum of rows from another table by join
One approach:

CREATE TEMPORARY TABLE x
    SELECT id, SUM(c) AS TheSum 
        FROM table2 ...;

UPDATE table1 JOIN x ON (table1.id = x.id)
    SET table1.a = x.TheSum
    WHERE table1.b = "something" AND table1.a IS NULL