title: Select a MySQL record that hasn't been used before or past a certain date
body: <p>I am trying to select 3 random records from a MySQL db where the lastUsedDate (the date the record was last updated) is beyond a set time period or NULL.</p>
  
  <p>My logic is this: </p>
  
  <ol>
  <li>If the lastUsedDate is NULL, then this record could be selected.</li>
  <li>If the lastUsedDate is 7 days or more older than the current date,
  it is a candidate to be randomly selected.</li>
  <li>I want to ignore dates that are 7 days and younger.</li>
  </ol>
  
  <p>I know <strong>Rand()</strong> is slow, but this table only has 30 records. </p>
  
  <pre><code>SELECT * FROM myTable 
  WHERE lastUsedDate &lt;= DATE_SUB(CURDATE() ,INTERVAL 7 DAY) OR lastUsedDate IS NULL 
  ORDER BY RAND()
  LIMIT 3
  </code></pre>
  
  <p>Eventually, after 30 days, the lastUsedDate will no longer be NULL as all 30 will be used up. This is why I want to recycle rows after 7 days.</p>
  
  <p>Anyone point me in the right direction?</p>