It is always appropriate to extend your sympathy for the family’s loss. If you have more to say, keep it positive. This is not the time to say anything negative.
The length of time you should spend talking to the family members will depend on how well you know them. If you are close, you may stand with them longer. However, if you don’t know them well, you should express your sympathy and politely move on so others will have an opportunity to talk to them.