Mysql Select vs Select SUM performance
The 2 queries that you show are different in meaning. 

The first one will select all upvotes for that ip and content in that timeframe. If you create the index:

mysql&gt; ALTER TABLE content_votes_tmp ADD INDEX(up, ip, content, datetime, record_num);
Query OK, 753676 rows affected (3.85 sec)
Records: 753676  Duplicates: 0  Warnings: 0


You can get good performance results- the first 2 columns will be used and you will get the Using Index optimization:

mysql&gt; EXPLAIN SELECT record_num 
               FROM content_votes_tmp  
               WHERE up = 1 AND 
                     ip = 1  AND 
                     content = 1 AND 
                     UNIX_TIMESTAMP(datetime) &gt; @number\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: content_votes_tmp
         type: ref
possible_keys: up
          key: up
      key_len: 12
          ref: const,const,const
         rows: 1
        Extra: Using where; Using index
1 row in set (0.00 sec)


We can do even better than that. Remove the UNIX_TIMESTAMP() function -compare dates instead of ints by transforming $old_time- and will be able to apply all conditions using the index (3 consts and 1 range):

mysql&gt; EXPLAIN SELECT record_num 
               FROM content_votes_tmp  
               WHERE up = 1 AND 
                     ip = 1  AND 
                     content = 1 AND 
                     datetime &gt; now()\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: content_votes_tmp
         type: range
possible_keys: up
          key: up
      key_len: 17
          ref: NULL
         rows: 1
        Extra: Using where; Using index
1 row in set (0.00 sec)


Be careful if the logic of the application requires to know if a downvote was done, this query will not help you with that.

The second one will require a slightly different index:

mysql&gt; ALTER TABLE content_votes_tmp ADD INDEX(ip, content, datetime, up);
Query OK, 753676 rows affected (5.95 sec)
Records: 753676  Duplicates: 0  Warnings: 0


In order to get a good query plan, also needing the "move the function to the other side of the operand":

mysql&gt; EXPLAIN SELECT SUM(up) as up_count 
       FROM content_votes_tmp  
       WHERE ip = 1 AND 
             content = 1 AND 
             datetime &gt; now()\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: content_votes_tmp
         type: range
possible_keys: ip
          key: ip
      key_len: 13
          ref: NULL
         rows: 1
        Extra: Using where; Using index
1 row in set (0.00 sec)


I do not like the range + SUM(), so I would prefer the first one, which is simpler (unless you intend to return lots of rows). But there is nothing on the query plan to support my fears (it has the covering index optimization too, and no filesort, so both can be very fast with the appropriate indexes- they take 0.00s with my fake 1M data).

Remember that the logic is slightly different, so be aware of that- if you allowed upvotes and downvotes, that could be a problem.