I get an unpredicted T_CONSTANT_ENCAPSED_STRING error within the following SQL query:

mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id');

Can everyone see in which the error may be?

This is actually the full code just in case it will help:

    $key = 'feed';
    $post_ids = array(2263, 2249); 

    foreach ($post_ids as $id) {
    $feedurl = get_post_custom_values($key, $id);
    $feedurlstr = implode($feedurl);

    // Ignore - it determines whether feed is live and returns $result
    LiveOrNot($feedurlstr);

    if ( $result == "live" ) {
    mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id');
    }    
    elseif ( $result == "notlive" ) {
    mysql_query (UPDATE 'wp_posts' SET 'post_status' = 'draft' WHERE 'post_id' = '$id');
    }
    endif;
    }

Wrap your SQL claims in quote-marks - ".

mysql_query ("UPDATE 'wp_posts' SET 'post_status' = 'publish' WHERE 'post_id' = '$id'");

mysql_query() requires a string. PHP is searching for constants interspersed with strings, which isn't valid PHP grammer.

You have to delimit your strings, ' and " are popular options, but there's also Heredoc syntax.

Read more about strings in PHP.