Never rtied this but instead of fetching the time and startdate from the table, try sending them to the function as parameters. Something like:
ALTER FUNCTION [dbo].[CalculateDelay]
(
@IsReturned BIT,
@StartDate DATETIME
@Time INT
)
RETURNS INT
AS
BEGIN
IF ( @IsReturned = 0 )
BEGIN
DECLARE @delay INT = ( SELECT ( DATEDIFF(minute,
DATEADD(day, @Time,
@StartDate),
GETDATE()) )
)
RETURN @delay
END
ELSE
BEGIN
RETURN NULL
END
RETURN NULL
END
If that doesn't help, I'd suggest to move the calculation to a trigger.