As a most general rule, yes, it would be legal to show in a film a trademarked name or logo in the manner you describe.
There are some precautions you as filmmaker need to take, however.
You should avoid defaming or disparaging an identifiable product or service (ie. having your characters drive by an identified or identifiable fast-food restaurant and having an actor say "that place uses rat meat in their chili"). And you cannot use a trademarked name or logo to promote your film (ie. using the Golden Arches in promotional material for your film).
Incidental uses of a trademark and the use of a trademark for descriptive purposes only (ie. having a character drink a Coke or speaking of wanting a Coke) would not be infringement. Confusing consumers into falsely thinking that your film is connected or endorsed by Coke, on the other hand, could result in a suit.
Because anyone can pretty much sue anyone else for any reason at all, it is always wise to have a film reviewed by an IP expert prior to publication, to eliminate any areas of legal risk. It is additionally wise to have liability insurance, enough to cover the costs of a lawsuit should one arise despite your best efforts to avoid one.
Good luck.