Will an expensive XLR cable offer better sound quality than a cheap one?

Should I buy the cheapest possible XLR cable then?
Probably not.  Durability and reliability are still an issue.  When XLR cables work, they all work the same.  However, if the cable is damaged or defective, it will have noise interference and other problems.  Hence, I wouldn’t recommend $2 XLR cable from China on eBay.  However, a $5-10 XLR cable from a reputable seller (like Amazon) with positive reviews should be fine.

Why should I buy a more expensive XLR cable?
If you are being paid to do a job involving audio (i.e. performing live on stage or having a client record in your studio), you want as much guarantee as possible that your cable won’t die out during the middle of a session.  Of course, if it’s just a podcasting setup or a beginner home studio, you can replace an occasionally defective cable with no embarrassment.  By my observation, decent budget XLR cables rarely die out.

How much does durability of the cable matter?
For home/studio use, probably not too much.  For outdoor or stage use, you will want an XLR cable that can handle being stretched and stepped on.

Perfect length?
Length has virtually no effect on audio quality or signal speed.  For a small office/studio setup, reducing the mess factor is a consideration: 6 feet should be fine (3 if you are a minimalist and the mic will be kept at or by the desk).  Of course, for an outdoor/stage setup or for a larger studio, 15-30 feet can be beneficial.

Thick vs. thin cables?
Thicker cables are well protected (not that thinner ones aren’t), but thinner ones are more flexible.  Does thickness make a real difference in audio quality?  No.