Mayonnaise can last up to 8 hour at room temperature and if the mayonnaise has been out at room temperature longer than 8 hours then it is likely spoiled and should be thrown out.
If you don't plan to use the mayonnaise within 8 hours you should refrigerate it to prevent spoilage of the mayonnaise.
As long as you keep the mayonnaise refrigerated the mayonnaise can last past the expiration date but if it smells bad or has any mold growing in the mayonnaise then it should be thrown out.