First off you should place your query into a variable instead of directly into the mysql_query() command. Makes it MUCH easier to debug later on.
In this case I would just use an ON DUPLICATE KEY UPDATE in the query.
You can just change your query as follows:
$query = "INSERT INTO user_images (user_id, ext) VALUES ('$id', '$file_ext')
ON DUPLICATE KEY UPDATE ext = '$file_ext'";
mysql_query($query) or die(mysql_error());