It would probably be best to do two query's.
//get the info for number of views and replies
$sql = mysql_query("SELECT * FROM table WHERE forumid='40'");
$row = mysql_fetch_array($sql);
$numofv = $row['number-of-views'];
$numofr = $row['number-of-replies'];
if($numofv >= '300')
{
$update1 = mysql_query("UPDATE table SET forumid='42' WHERE forumid='40'");
}
if($numofr >= '50')
{
$update2 = mysql_query("UPDATE table SET forumid='42' WHERE forumid='40'");
}
That is just basics. You can modify it to fit your needs.
Hope that helps,
-Blake