Use the current_post
property of the WP_Query
object:
function new_excerpt_length($length) {
global $wp_query; // assuming you are using the main query
if ( 0 === $wp_query->current_post)
return 50;
else
return 20;
}
The function may need further tweaks to avoid interfering with other queries in unintended ways, but that is the basic idea.