UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p+AFuCw9leqPa1kPT8huSq3OZPByQdBC1at0YU1nbAE=' 
WHERE 
  key_id = 'cda9599e823929f65765b5344faa9748b1acfd1ae2916d58aa49c53c5ae8e8cf' 
  AND (
    token = 'p+AFuCw9leqPa1kPT8huSq3OZPByQdBC1at0YU1nbAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035