Upsert Row If Columns Don't Match
You can add a WHERE clause to the UPDATE part of an INSERT ... ON CONFLICT

insert into the_table (sid, somecolumn)
values (...)
on conflict (sid) do update 
  set somecolumn = excluded.somecolumn, 
      changed = true
where the_table.somecolumn &lt;&gt; excluded.somecolumn;


If you need to deal with NULL values in somecolumn use 

where the_table.somecolumn is distinct from excluded.somecolumn