create table mytable(id int primary key, color text, locked bool);
create unique index on mytable (id) where locked = false;
insert into mytable values 
(1, 'red', true);
insert into mytable values 
(1, 'blue', true); 
on conflict (id) where locked = false do update
set color = excluded.color;
