UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NoCX+FMKcpc48FK3rJFCEbzBoLnbTP3UgBhtbEKCUT0=' 
WHERE 
  key_id = '3c3c71660e70fd44930c81fc1a716e8df11331b1fee1594ee5151b2c58acd3a2' 
  AND (
    token = 'NoCX+FMKcpc48FK3rJFCEbzBoLnbTP3UgBhtbEKCUT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027