UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GTRRW8S0irF4XatCFhm8LdXwEfc+R7nXETDVVGLMg1g=' 
WHERE 
  key_id = '8d62a95de05746ba9535e6b55f783d41cf108cb973d59f57a8083bcbbf74a249' 
  AND (
    token = 'GTRRW8S0irF4XatCFhm8LdXwEfc+R7nXETDVVGLMg1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029