UPDATE multicards
SET defacements = COALESCE( count, 0 )
FROM ( SELECT multicard_uid, COUNT(*) AS count FROM tickets GROUP BY multicard_uid ) AS sub
WHERE uid = multicard_uid OR multicard_uid is null;
I expect this should work. Not sure of performance of course.