When a video clip is trimmed down, say from 30 minutes to 8.5 minutes as in your case, then it should export at 8.5 minutes. The trimmed out part gets left behind and does not export. Sometimes, an audio clip, or a fragment from previous editing, can extend in the timeline beyond the end point of the trimmed clip. That would cause the movie to export at an extended time duration. Use the slider above and to the right of the timeline to expand out the timeline. Inspect to confirm that no unwanted fragments exist. If you find any, cut them out and try exporting again.
If you find no fragments, it is possible that an iMovie preferences has gone awry. Try deleting/resetting preferences. To do that, open iMovie while holding down the Option and Command keys and select to delete preferences in the box that appears. iMovie usually will open in a new empty library. If so, reopen your old library to get back to your projects. Possibly you may need to reboot to set the changes. Now see if you can export the project at the proper length. Deleting preferences is a safe procedure that will not cause data loss or disruption to your project.
Also, you can try creating a new project and placing your media into it, and then export from there Sometimes glitches can occur in a project that are specific to that project and do not appear in a different project.
-- Rich