Sounds like the ubiquitous left join is what you need
SELECT id from table1 LEFT JOIN table2
ON table1.cod_us=table2.cod_us_cert WHERE table2.cod_us_cert IS NULL
Then you could read all the rows into an array, implode them and do whatever you want with them, like
while ($row=mysql_fetch_row($res))
{
$ids[]=$row[0];
}
$ids=implode(',', $ids);
$query="DELETE FROM table1 WHERE id in ($ids)";
If you did want a temporary table using the create -> select thing is really good for it, like:
CREATE TEMPORARY TABLE tempTab AS SELECT id from table1 LEFT JOIN table2
ON table1.cod_us=table2.cod_us_cert WHERE table2.cod_us_cert IS NULL
And in case you haven't used them much, you don't have to worry about temp tables interfering with each other. If you've got 100 scrips running creating the same named temp table they're 'just pretend' so you won't write into ones present in the other scripts.
Hope that does for you.