UPDATE 
 `visit` 
 
SET  
 `id_user` = IF( :id_user>0, :id_user, `id_user` ),
 `counter` = ( `counter` + 1 )
  
WHERE 
 `ID` = :ID 