UPDATE [dbo].[MarketplaceListingReviews]
SET [Status] = @NewStatus, [ReviewerEmail] = @ReviewerEmail, [ReviewerNotes] = @ReviewerNotes, [ResolvedAtUtc] = CASE
    WHEN @NewStatus = 0 THEN NULL -- Pending
    ELSE @ResolvedAtUtc
END
,
    [UpdatedAtUtc]  = SYSUTCDATETIME()
OUTPUT inserted.*
WHERE [Id] = @ReviewId
  AND [Status] = @ExpectedStatus;
