In case='E', you are searching for minput+minstage+moutput+moutstage (which is updated) in table mos_in_output which is not updated.
Ex. INPUT field before is equal to '200' and you save this to variable minput. Then the user change the value of minput to '300'. And then you want the INPUT field to be updated by searching INPUT=MINPUT. The error is that the minput=300 and the INPUT=200. You can't locate it because the minput already changed and not equal to INPUT field.