delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;