UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbIjnFCyE/AvIofPv4jX+YUXUTrBWFeltYeRU86ERzE=' 
WHERE 
  key_id = '0cc713d08e048aace359e69312a84d10724984ee707659dfa68b292ff2c5be9d' 
  AND (
    token = 'IbIjnFCyE/AvIofPv4jX+YUXUTrBWFeltYeRU86ERzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035