While the values may be stored in internal.object_parameters, resist the temptation to edit the values in those tables directly. Instead use the supplied methods for manipulation. In this case, the stored procedure catalog.set_environment_variable_value.
Below is a sample of how you can programmatically change the value of an environment variable. I would see this as being a TSQL jobstep in SQL Agent job that runs prior to your package launching to ensure the correct values for StartDateTime and EndDateTime are set as expected.
DECLARE @var sql_variant;
DECLARE
@StartDateTime date
, @EndDateTime datetime
, @RunType bit = 1;
SELECT
@StartDateTime = CAST(dateadd(d, -1, CURRENT_TIMESTAMP) AS date)
, @EndDateTime = DATEADD(s, -1, cast(cast(current_timestamp AS date) AS datetime))
SELECT @StartDateTime, @EndDateTime;
IF (@RunType = 1)
BEGIN
SET @var = @StartDateTime;
EXECUTE [SSISDB].[catalog].[set_environment_variable_value]
@variable_name=N'StartDateTime'
, @environment_name=N'MyEnvironmentName'
, @folder_name=N'MyFolder'
, @value=@var;
SET @var = @EndDateTime;
EXECUTE [SSISDB].[catalog].[set_environment_variable_value]
@variable_name=N'EndDateTime'
, @environment_name=N'MyEnvironmentName'
, @folder_name=N'MyFolder'
, @value=@var;
END
ELSE
BEGIN
PRINT 'Logic goes here to handle the other conditions for RunType'
END