UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eU5B60mZ+ngwj9R0JdKcf3EdjyLMmSahaHWUkaToCuA=' 
WHERE 
  key_id = '786d6eb56774bc7f67fe1f01a247304730cecd819e253c5ce2dadd43157946c2' 
  AND (
    token = 'eU5B60mZ+ngwj9R0JdKcf3EdjyLMmSahaHWUkaToCuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029