I like to make baby quilts the width of the flannel yardage with which I back them, which is about 42". The other direction, for a new baby, is usually about 36". I guess that means that I would add a 2" border to your 31 x 40 top.
I think playpen size is about 40 x42 -- I know they're not exactly square.
Maximum baby quilt size, to me, is 42 x 50 which should work as long as the baby is in a standard crib.