UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'krLoMHjKTQQrie5MDbiBV0AZycnHBtMqjFTHRaiq7Aw=' 
WHERE 
  key_id = '40b87fb3312285e213ffcf202cb7b73e18ab97566ff4ab19363e5b10395aa652' 
  AND (
    token = 'krLoMHjKTQQrie5MDbiBV0AZycnHBtMqjFTHRaiq7Aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035