Consider adding a flag to the User table that indicates if the user is a temporary user or not:
alter table user add is_temp tinyint unsigned default 0 not null;
This will allow a simple foreign key reference from In_Out:
alter table In_Out
change id User_id <Match Data Type And Nullness Here>,
add constraint User_id_fk foreign key (User_id) references User(id);
solved How to refer 2 columns from a single column in mysql [duplicate]